#include<bits/stdc++.h>

#define int long long
using namespace std;

signed main()
{
    int n;
    cin >> n;
    vector<int>arr(n + 10);
    for(int i = 1; i <= n; i ++)
    {
        cin >> arr[i];
    }
    map<int,int>cc;
    for(int i = 1; i <= n; i ++)
    {
        cc[arr[i]]++;
    }
    int cnt = 0;
    int uu = 0;
    for(auto x : cc)
    {
        if(x.second >= 3)
        {
            cnt += x.second - 2;
        }
        if(x.second == 1)
        {
            uu++;
        }
    }
    if(cnt >= uu)
    {
        cout << cnt << endl;
        return 0;
    }
    else
    {
        cout << cnt + (uu - cnt) / 2 << endl;
    }
}